import java.util.Stack;

public class text {
    public  static boolean KuoHao(String str){
        Stack<Character> stack=new Stack<>();
        for(int i=0;i<str.length();i++){
            char ch=str.charAt(i);
            if (ch == '(' || ch == '{' || ch =='[') {
                stack.push(ch);
            }else{
                if(stack.empty()){
                    return false;
                }
                char ch1=stack.peek();
                if(ch==')'&&ch1=='('||ch=='}'&&ch1=='{'||ch==']'&&ch1=='['){
                    stack.pop();
                }else{
                    return false;
                }
            }
        }
        if(!stack.empty()){
            return false;
        }
        return true;
    }
    public static void main1(String[] args){
        String str="({[]})";
        boolean ret=KuoHao(str);
        System.out.println(ret);
    }
}
